package com.mini.constant;

import java.util.HashMap;

/**
 * @author zhangxiaobin
 * @title: AllocationLevel
 * @description: TODO
 * @date 2020/7/1711:26
 */
public enum AllocationLevel {

    S(1), A(2), B(3), C(4);

    private int key ;

    AllocationLevel(int key){
        this.key = key;
    }

    public int getKey(){
        return key;
    }

    private static HashMap<Integer,AllocationLevel> map = new HashMap<>();

    static {
        for( AllocationLevel a : AllocationLevel.values() ){
            map.put(a.key,a);
        }
    }

    public static AllocationLevel parse(Integer val){
        if(val == null){
            return null;
        }
        if(map.containsKey(val)){
            return map.get(val);
        }
        return null;
    }
}
